package com.du.stutestsys.controller;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


import javax.servlet.http.HttpSession;



public class BaseControler {
    protected Logger logger = (Logger) LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);

    protected Object checkRole(HttpSession session){
        java.lang.Object o = session.getAttribute("roleType");

        if (null==o){
            logger.info("no Role");
            return null;
        }

        logger.info("yes Role");
        return o;
    }

    protected Object checkAdmin(HttpSession session){
        java.lang.Object o = session.getAttribute("adminId");

        if (null==o){
            logger.info("no admin");
            return null;
        }

        logger.info("yes admin");
        return o;
    }

    protected Object checkUser(HttpSession session){
        java.lang.Object o = session.getAttribute("userId");
        if (null==o){
            logger.info("no user");
            return null;
        }

        logger.info("yes user");
        return o;
    }
}
